/*
 * @Author: zi.yang
 * @Date: 2021-05-24 10:53:24
 * @LastEditors: zi.yang
 * @LastEditTime: 2021-10-03 01:51:21
 * @Description: 身份验证-Token
 * @FilePath: \ziYangPM\src\Utils\auth.js
 */
import Cookies from 'js-cookie'

// 声明 token key
const TokenKey = 'ZI.YANG-PM-USER-TOKEN'

/**
 * 获取 token
 * @returns { String } Token
 */
export function getToken () {
  return Cookies.get(TokenKey)
}

/**
 * 设置 token
 * @param { String } token
 * @returns
 */
export function setToken (token) {
  return Cookies.set(TokenKey, token, { secure: false, sameSite: 'Lax' })
}

/**
 * 移除 token
 * @returns
 */
export function removeToken () {
  return Cookies.remove(TokenKey)
}
